//
//  UtraMonitorThread.h
//  testWX
//
//  Created by 李 坚 on 12-12-27.
//  Copyright (c) 2012年 lijian. All rights reserved.
//

#ifndef __testWX__UtraMonitorThread__
#define __testWX__UtraMonitorThread__

#include <iostream>
#include "Utra.h"
#include "MainFrame.h"
#include <wx/thread.h>

class MainFrame;

class UtraThreadEvent : public wxThreadEvent{
public:
    UtraThreadEvent(wxEventType eventType, int id,char* data,int size);
    
    UtraThreadEvent(const UtraThreadEvent& event):wxThreadEvent(event){
        memcpy(m_dataBuff, event.m_dataBuff, 1024);
        m_size=event.m_size;
    }
    
    int getSize(){
        return m_size;
    }
    
    char* getData(){
        return m_dataBuff;
    }
    
    virtual wxEvent *Clone() const{
        return new UtraThreadEvent(*this);
    }
private:
    int m_size;
    char m_dataBuff[1024];
};

class UtraMonitorThread: public wxThread {
public:
    UtraMonitorThread(Uart * utra,MainFrame* frame);
    virtual void *Entry();
    
    void stop();
    
private:
    Uart * utra;
    MainFrame* frame;
    bool m_start;
};

#endif /* defined(__testWX__UtraMonitorThread__) */
